Shareware Registration
It is quite common to see software that can be downloaded and used for evaluation purposes. This type of software is called shareware. Some programs distributed this way have a time limit. Others have features that are unavailable in the shareware version. When the user enters a registration code, the software is converted to the full version and all restrictions are removed. Liberty BASIC is distributed in this fashion.
Accepting Payment for Shareware
The author of the software must have a way of receiving payment from users. Upon receipt of payment, the author provides a registration key or code to unlock the software and convert it from the shareware version to the full version.
Liberty BASIC works this way. When a user has registered, he enters his name and registration code to unlock Liberty BASIC GOLD or SILVER.
Payment Processing Services
There are many payment processing services online. BlackCat Systems has a web page that lists many of these services, along with their fees and features. Click the link below to learn more.
[http://www.blackcatsystems.com/regservices/]
Since many of these payment processing services do not require an exclusive agreement, you may use more than one at the same time.
Most payment processing services will send out registration keys to your users when their payment is received. You can give them a list of valid registration codes, or you can provide an algorithm to generate codes. You can also choose to handle this function yourself by emailing customers when you receive notice of the order.
Each service has its own methods and rules, so investigate them and research their contracts and help systems for particulars.
Snail Mail
Liberty BASIC includes a printable registration form in its help menu so that people can register by snail mail. If you are selling shareware, you can make use of this method as well.
PayPal
[Paypal ] is a popular web-based service that allows people to send money to others electronically. It is often used by online auction participants, but it can also be used by software authors to accept payments. Visit the [Paypal ] site to learn more.
Generating Keys
You'll need to decide on a method to generate registration passwords, codes, or keys. Liberty BASIC uses an algorithm based on the user's name to generate a registration code. That is a common practice in shareware. Some shareware registrations involve keys that are quite long, in hopes of foiling software pirates. Some shareware registrations are time-limited, while others are tied to a particular computer. See the section on "Commercial Protection" below for information on commercial registration key generators. If you want to create your own algorithm for generating valid registration codes, start by reading the articles on encryption that are listed below.
Encryption
Passwords and registration codes are often encrypted to make them more secure. There are two newsletter articles that discuss encryption. If you want to create your own encrypted passwords, registration codes or keys, please read about encryption in issue #123 by Bob Bromley, and in issue #108 by David Drake
Commercial Protection
For the most secure and professional method of protecting your shareware, you can use a commercial protection service or program. The most honored of these is [Armadillo]. You can do a web search for "Software Protection" and find many other such services. They range in price from very expensive to free.
Storing Registration Information
Issue #102 of the newsletter has an article called "Safe Registry and Ini File Alternative." It gives a small example of storing a password in an ini file. It describes the use of an API-created ini file. The same methods are covered a little differently in this issue's article on Ini Files for Professional Software. Please read one or both of these articles before studying the demo program below.
Demo
The following small demonstration program shows how to store a password in an ini file, and how to retrieve it. In real life, the routine to check for a valid password or registration code would be dependent upon the algorithm used to create the password or code. The password would also probably be encrypted. The program would also check for a valid registration at startup, not at the press of a button as is done here.
The methods used to protect registered versions of shareware are many and varied. This little program is meant to be a starting point for you to begin creating your own protection scheme, which will be unique to your software.
pass$ = "wolverine" 'your registration password
nomainwin
button #1.reg, "Register",[reg],UL,10,10,120,26
button #1.check, "Check Registration", [readReg], UL, 10, 50, 120, 26
open "Register My App" for window_nf as #1
#1 "trapclose [quit]"
wait
[quit]
close #1:end
[reg]
pw$ = "no password"
prompt "Enter password";pw$
if pw$="" then
notice "Not a valid password."
end if
call WriteIniFile "My Program", "Password", pw$, "myapp.ini"
wait
[readReg]
Key$ = GetIniFile$("My Program","Password","no password","myapp.ini")
if Key$ <> pass$ then
notice "Not registered."
else
notice "Registered user."
end if
wait
Sub WriteIniFile lpAppName$, lpKeyName$, lpString$, lpFileName$
CallDLL #kernel32, "WritePrivateProfileStringA", _
lpAppName$ As ptr, _ 'section name
lpKeyName$ As ptr, _ 'key name
lpString$ As ptr, _ 'key value
lpFileName$ As ptr, _ 'ini filename
result As boolean 'nonzero = success
end sub
Function GetIniFile$(lpAppName$, lpKeyName$,lpDefault$,lpFileName$)
nSize=100
lpReturnedString$=Space$(nSize)+Chr$(0)
CallDLL #kernel32, "GetPrivateProfileStringA", _
lpAppName$ As ptr, _'section name
lpKeyName$ As ptr, _'key name
lpDefault$ As ptr, _'default string returned if there is no entry
lpReturnedString$ As ptr, _ 'destination buffer
nSize As long, _ 'size of destination buffer
lpFileName$ As ptr, _ 'ini filename
result As ulong 'number of characters copied to buffer
GetIniFile$=Left$(lpReturnedString$,result)
end function